package com.linwj.hello.spring.cloud.alibaba.provider.xxlTask;

import com.linwj.hello.spring.cloud.alibaba.provider.controller.NacosProviderController;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@JobHandler(value = "xxlJobTestHandler")
@Component
public class XxlJobTestHandler extends IJobHandler {

    @Autowired
    private NacosProviderController nacosProviderController;

    @Override
    public ReturnT<String> execute(String param) {
        try {
            nacosProviderController.sayHi(param);
        } catch (Exception e) {
            return new ReturnT<>(IJobHandler.FAIL.getCode(), "执行器执行失败");
        }
        return IJobHandler.SUCCESS;
    }

}
